from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
from django.views.generic import View

class RegisterView(View):
    """类视图：处理注册"""

    def get(self, request):
        a = request.GET.get('key')

        # 打印
        print(a)  # 3


        return HttpResponse('python:py37')

    def post(self, request):
        """处理 POST 请求，实现注册逻辑"""
        print('RegisterView post')
        return HttpResponse('python:py37添加成功')

    def qs(request):
        # 获取查询字符串参数
        a = request.GET.get('a')
        b = request.GET.get('b')
        alist = request.GET.getlist('a')
        # 打印
        print(a)  # 3
        print(b)  # 2
        print(alist)  # ['1', '3']
        # 返回响应对象
        return HttpResponse('OK')